package com.example.mapper;

//import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.pojo.entity.Collection;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface CollectionMapper  {
    @Insert("insert into  `collection` (name,type,picture,description,content,show_state) values (#{name},#{type},#{picture},#{description},#{content},#{showState})" )
    void insert(Collection collection);

    @Update("update `collection` set name = #{name},type = #{type},picture = #{picture},description = #{description},content = #{content},show_state = #{showState} where id = #{id}")
    void updateById(Collection collection);

    @Update("delete from `collection` where id = #{id}")
    void removeById(Integer id);

    @Select("select * from `collection` order by id desc ")
    List<Collection> list();

    @Select("select * from `collection` where id = #{id}")
    Collection getById(Integer id);


    List<Collection> selectByPage(String name, String type, Integer showState);
}
